using UnityEngine;
using System.Collections;

[ExecuteInEditMode()]

public class StartMenuGUI : MonoBehaviour
{
	public GUISkin gSkin;
	public Texture2D backdrop;
	private bool isLoading = false;
	
	public void OnGUI()
	{
		if(gSkin)
		{
			GUI.skin = gSkin;	
		}
		else
		{
		Debug.LogError("StartMenuGUI : GUI Skin object missing!");	
		}
		GUIStyle backgroundStyle = new GUIStyle();
		backgroundStyle.normal.background = backdrop;
		GUI.Label(new Rect((Screen.width - (Screen.height * 2)) * 0.75f, 0, Screen.height *2, Screen.height), "", backgroundStyle);
		GUI.Label(new Rect((Screen.width /2) - 197, 50, 400, 100), "Ascension", "mainMenuTitle");
		
		if(GUI.Button(new Rect((Screen.width /2 )-70, Screen.height - 160, 140, 70), "Play"))
		{
			isLoading = true;
			Application.LoadLevel("Level_1");
		}
		
		bool isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer);
		
		if(!isWebPlayer)
		{
			if(GUI.Button(new Rect((Screen.width /2) - 70, Screen.height - 80, 140, 70), "Quit"))
			{
				Application.Quit();	
			}
		}
		if(isLoading)
		{
			GUI.Label(new Rect((Screen.width /2) -110, (Screen.height /2) -60, 400, 70),"Loading", "mainMenuTitle");
		}
		
	}
		
}
